package core

import (
	"fmt"
	"gopkg.in/yaml.v3"
	"leading/config"
	"leading/global"
	"os"
)

const ConfigFilePath = "setting.yaml"

func InitConfig() {
	data, err := os.ReadFile(ConfigFilePath)
	fmt.Println(data)
	if err != nil {
		fmt.Println("读取文件失败", nil)
		return
	}

	config := config.Config{}
	err = yaml.Unmarshal(data, &config)
	if err != nil {
		fmt.Println("解析 yaml 文件失败：", err)
		return
	}
	global.Config = &config
}
